package com.example.demo.vo;

import java.util.ArrayList;
import java.util.List;

public class AnalyseResultVO {
    private List<KV> data;

    public AnalyseResultVO() {
        this.data = new ArrayList<>();
    }

    public List<KV> getData() { return data; }

    public void setNouns(String[] nouns) {
        if (nouns == null) return;
        for (int i = 0; i < nouns.length; i++) {
            if (nouns[i] == null) continue;
            if (!nouns[i].equals("") && !nouns[i].equals("set()")) this.data.add(new KV("名词", nouns[i]));
        }
    }

    public void setVerbs(String[] verbs) {
        if (verbs == null) return;
        for (int i = 0; i < verbs.length; i++) {
            if (verbs[i] == null) continue;
            if (!verbs[i].equals("")) this.data.add(new KV("动词", verbs[i]));
        }
    }

    public void setAdjs(String[] adjs) {
        if (adjs == null) return;
        for (int i = 0; i < adjs.length; i++) {
            if (adjs[i] == null) continue;
            if (!adjs[i].equals("")) this.data.add(new KV("形容词", adjs[i]));
        }
    }

    public void setDates(String[] dates) {
        if (dates == null) return;
        for (int i = 0; i < dates.length; i++) {
            if (dates[i] == null) continue;
            if (!dates[i].equals("")) this.data.add(new KV("日期",  dates[i]));
        }
    }

    class KV {
        public String characteristic;
        public String word;

        public KV(String characteristic, String word) {
            this.characteristic = characteristic;
            this.word = word;
        }
    
        public String getCharacteristic() {
            return characteristic;
        }

        public String getWord() {
            return word;
        }
    }
}
